<?php include "../public/header.php";?>
<?php include "../public/header_show.php";?>
<body id="xiangqingPage">
<div id="xiangqingBox">
    <div class="page-title">
        <div class="page-title-con">
            <span class="pageshowtitle">详情</span>
            <div class="page-title-opt-list">
                <?php include "../public_flow/flow_show_optbut.php";?>
                <button class="layui-btn layui-btn-sm btn-light marginr5 opt">
                    操作<i class="layui-icon layui-icon-down layui-font-12"></i>
                </button>
                <span id="page-close" class="page-close" onclick="layer_close()">×</span>
            </div>
        </div>
    </div>
    <div class="main-container">
        <div><?php include "../public_flow/flow_show_info.php";?></div>
        <div class="tongbox tongbox5">
            <div class="tuo"><div class="tit">项目名称</div><div class="con" id="tong_enginname"></div></div>
            <div class="tuo"><div class="tit">变更单号</div><div class="con" id="tong_number"></div></div>
            <div class="tuo"><div class="tit">原预算主题</div><div class="con" id="tong_budgetid_name"></div></div>
            <div class="tuo"><div class="tit">变更类型</div><div class="con" id="tong_type_name"></div></div>
            <div class="tuo"><div class="tit">申请人</div><div class="con" id="tong_flowuser"></div></div>
        </div>
        <div class="table-box tablenes">
            <div class="title">项目信息</div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">项目名称</td><td class="tv colorlan" id="enginid_name" colspan="3"></td></tr>
                </tbody>
            </table>
        </div>
        <div class="table-box tablenes">
            <div class="title">原预算信息</div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">原预算主题</td><td class="tv colorlan" id="budgetid_name"></td><td class="tt">原预算编号</td><td class="tv" id="budget_number"></td></tr>
                </tbody>
            </table>
        </div>
        <div class="table-box tablenes">
            <div class="title">预算变更信息</div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">本次变更主题</td><td class="tv" id="title"></td><td class="tt">变更单号</td><td class="tv" id="number"></td></tr>
                <tr><td class="tt">变更类型</td><td class="tv" id="type_name" colspan="3"></td></tr>
                <tr><td class="tt">备注</td><td class="tv" id="explain" colspan="3"></td></tr>
                </tbody>
            </table>
        </div>

        <div><?php include "../public/upinfo_show.php";?></div>

        <div><?php include "../public_flow/flow_show_flowrelas.php";?></div>

        <div class="table-box tablenes layui-hide" id="tiaoDiv">
            <script type="text/html" id="toolbarDemo">调整明细</script>
            <div class="tableShow">
                <table id="datalist" lay-filter="datalist"></table>
            </div>
        </div>

        <div class="table-box tablenes layui-hide" id="zengDiv">
            <script type="text/html" id="toolbarDemo_zeng">增项明细</script>
            <div class="tableShow">
                <table id="datalist_zeng" lay-filter="datalist_zeng"></table>
            </div>
        </div>

        <div><?php include '../public_flow/flow_show_shenlog.php'?></div>
        <div><?php include '../public_flow/flow_show_talk.php'?></div>
        <div><?php include '../public/opt_browse.php'?></div>
    </div>

    <div class="showrrboxtext">
        <div class="table-box tablenes">
            <div class="title">总预算</div>
            <div class="tuo"><div class="tit">预算额(元)</div><div class="con" id="right_budget_money">0</div></div>
            <div class="tuo"><div class="tit">合同额(元)</div><div class="con" id="right_caimoney">0</div></div>
            <div class="tuo"><div class="tit">合同/预算占比(%)</div><div class="con" id="right_budget_rate_all">0</div></div>
        </div>
        <div class="table-box tablenes">
            <div class="title">材料预算</div>
            <div class="tuo"><div class="tit">预算额(元)</div><div class="con" id="right_budget_caifee">0</div></div>
            <div class="tuo"><div class="tit">合同额(元)</div><div class="con" id="right_cai_hefee">0</div></div>
            <div class="tuo"><div class="tit">合同/预算占比(%)</div><div class="con" id="right_budget_rate_cai">0</div></div>
        </div>
        <div class="table-box tablenes">
            <div class="title">人工预算</div>
            <div class="tuo"><div class="tit">预算额(元)</div><div class="con" id="right_budget_renfee">0</div></div>
            <div class="tuo"><div class="tit">合同额(元)</div><div class="con" id="right_ren_hefee">0</div></div>
            <div class="tuo"><div class="tit">合同/预算占比(%)</div><div class="con" id="right_budget_rate_ren">0</div></div>
        </div>
        <div class="table-box tablenes">
            <div class="title">机械设备预算</div>
            <div class="tuo"><div class="tit">预算额(元)</div><div class="con" id="right_budget_jifee">0</div></div>
            <div class="tuo"><div class="tit">合同额(元)</div><div class="con" id="right_ji_hefee">0</div></div>
            <div class="tuo"><div class="tit">合同/预算占比(%)</div><div class="con" id="right_budget_rate_ji">0</div></div>
        </div>
        <div class="table-box tablenes">
            <div class="title">专业分包预算</div>
            <div class="tuo"><div class="tit">预算额(元)</div><div class="con" id="right_budget_fenfee">0</div></div>
            <div class="tuo"><div class="tit">合同额(元)</div><div class="con" id="right_fen_hefee">0</div></div>
            <div class="tuo"><div class="tit">合同/预算占比(%)</div><div class="con" id="right_budget_rate_fen">0</div></div>
        </div>
        <div class="table-box tablenes">
            <div class="title">其他费预算</div>
            <div class="tuo"><div class="tit">预算额(元)</div><div class="con" id="right_budget_qifee">0</div></div>
            <div class="tuo"><div class="tit">合同额(元)</div><div class="con" id="right_qi_hefee">0</div></div>
            <div class="tuo"><div class="tit">合同/预算占比(%)</div><div class="con" id="right_budget_rate_qi">0</div></div>
        </div>
    </div>
    <div><?php include '../public/shrrbox.php'?></div>
</div>
<script>
    var param_id = getQueryVariable('id') || 0;

    layui.use(['form', 'layer', "laytp",'element','dropdown','laypage','table','soulTable'], function() {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable,element = layui.element;

        facade.ajax({url: ask_engin_budbian_show, data:{id: param_id}}).done(function(res){
            if (res.code === 2000) {
                var data = res.data.data;
                var engininfo = res.data.engininfo;
                var budgetinfo = res.data.budgetinfo;
                $("#flowdingname").text(data.title);

                if(engininfo){
                    $("#tong_enginname").text(engininfo.name);
                }
                $("#tong_number").text(data.number);
                if(budgetinfo){
                    $("#tong_budgetid_name").text(budgetinfo.title);
                }
                $("#tong_type_name").text(data.type_name);
                $("#tong_flowuser").text(data.flowuser);


                if(engininfo){
                    $("#right_budget_money").text(parseFormatNum(engininfo.budget_money));
                    $("#right_caimoney").text(parseFormatNum(engininfo.caimoney)).addClass('colorlan').click(function () {
                        openNavPage('查看支出合同信息','contract_cai/index.php?status=1&enginid='+engininfo.id);
                    });
                    $("#right_budget_rate_all").text(engininfo.budget_rate_all);


                    $("#right_budget_caifee").text(parseFormatNum(engininfo.budget_caifee));
                    $("#right_cai_hefee").text(parseFormatNum(engininfo.cai_hefee)).addClass('colorlan').click(function () {
                        openNavPage('查看支出合同信息','contract_cai/index.php?status=1&caitype=cai&enginid='+engininfo.id);
                    });
                    $("#right_budget_rate_cai").text(engininfo.budget_rate_cai);

                    $("#right_budget_renfee").text(parseFormatNum(engininfo.budget_renfee));
                    $("#right_ren_hefee").text(parseFormatNum(engininfo.ren_hefee)).addClass('colorlan').click(function () {
                        openNavPage('查看支出合同信息','contract_cai/index.php?status=1&caitype=ren&enginid='+engininfo.id);
                    });
                    $("#right_budget_rate_ren").text(engininfo.budget_rate_ren);

                    $("#right_budget_jifee").text(parseFormatNum(engininfo.budget_jifee));
                    $("#right_ji_hefee").text(parseFormatNum(engininfo.ji_hefee)).addClass('colorlan').click(function () {
                        openNavPage('查看支出合同信息','contract_cai/index.php?status=1&caitype=ji&enginid='+engininfo.id);
                    });
                    $("#right_budget_rate_ji").text(engininfo.budget_rate_ji);

                    $("#right_budget_fenfee").text(parseFormatNum(engininfo.budget_fenfee));
                    $("#right_fen_hefee").text(parseFormatNum(engininfo.fen_hefee)).addClass('colorlan').click(function () {
                        openNavPage('查看支出合同信息','contract_cai/index.php?status=1&caitype=fen&enginid='+engininfo.id);
                    });
                    $("#right_budget_rate_fen").text(engininfo.budget_rate_fen);

                    $("#right_budget_qifee").text(parseFormatNum(engininfo.budget_qifee));
                    $("#right_qi_hefee").text(parseFormatNum(engininfo.qi_hefee)).addClass('colorlan').click(function () {
                        openNavPage('查看支出合同信息','contract_cai/index.php?status=1&caitype=qi&enginid='+engininfo.id);
                    });
                    $("#right_budget_rate_qi").text(engininfo.budget_rate_qi);

                }











                if(engininfo){
                    $("#enginid_name").text(engininfo.name).click(function () {
                        openPage('../engin/show.php?id='+engininfo.id);
                    });
                }
                if(budgetinfo){
                    $("#budgetid_name").text(budgetinfo.title).click(function () {
                        openPage('../engin_budget/show.php?id='+budgetinfo.id);
                    });
                    $("#budget_number").text(budgetinfo.number);
                }


                $("#number").text(data.number);
                $("#title").text(data.title);
                $("#type_name").text(data.type_name);
                $("#explain").text(data.explain);

                if(data.type == 1 || data.type == 3){
                    $("#tiaoDiv").removeClass('layui-hide');
                }
                if(data.type == 2 || data.type == 3){
                    $("#zengDiv").removeClass('layui-hide');
                }

                var mytableList = table.render({
                    elem: "#datalist",data:res.data.tiaolist, toolbar: '#toolbarDemo', page: false
                    ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                    ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text
                    ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                    , cols: [[
                        {type:'numbers',title:'序号',fixed:'left'}
                        ,{field: 'budtype_name', title: '预算分类'}
                        ,{field: 'name', title: '名称及规格'}
                        ,{field: 'unit', title: '单位'}
                        ,{field: 'num', title: '预算数量'}
                        ,{field: 'price', title: '预算单价(元)',align:'right',templet: function(d){return parseFormatNum(d.price);}}
                        ,{field: 'money', title: '预算金额(元)',align:'right',templet: function(d){return parseFormatNum(d.money);}}
                        ,{field: 'new_num', title: '变更后数量'}
                        ,{field: 'new_price', title: '变更后预算单价(元)',align:'right',templet: function(d){return parseFormatNum(d.new_price);}}
                        ,{field: 'new_money', title: '变更后预算金额(元)',align:'right',templet: function(d){return parseFormatNum(d.new_money);}}
                        ,{field: 'explain', title: '变更原因'}
                    ]]
                    , done: function (res) {
                        soulTable.render(this);
                    }
                });

                var mytableList22 = table.render({
                    elem: "#datalist_zeng",data:res.data.zenglist, toolbar: '#toolbarDemo_zeng', page: false
                    ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                    ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text
                    ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                    , cols: [[
                        {type:'numbers',title:'序号',fixed:'left'}
                        ,{field: 'budtype_name', title: '预算分类'}
                        ,{field: 'name', title: '名称及规格'}
                        ,{field: 'unit', title: '单位'}
                        ,{field: 'num', title: '预算数量'}
                        ,{field: 'price', title: '预算单价(元)',align:'right',templet: function(d){return parseFormatNum(d.price);}}
                        ,{field: 'money', title: '预算金额(元)',align:'right',templet: function(d){return parseFormatNum(d.money);}}
                        ,{field: 'explain', title: '增项原因'}
                    ]]
                    , done: function (res) {
                        soulTable.render(this);
                    }
                });


                public_flow_show_display(res.data.billinfo);
                public_upload_show_file('upload_files', res.data.files);
                render_from();
            }
        });

        public_get_readsandlog('engin_budbian', param_id);
    });



</script>
</body>
</html>




